<template>
  <div>
    <h1 class="item-wrapper">当前获取到的登录令牌:</h1>
    <h3>{{ accessToken }}</h3>
    <el-button type="primary" v-on:click="showNativeLoginView">拉起原生登录框</el-button>
    <el-button type="primary" v-on:click="nativepush">原生跳转测试</el-button>
  </div>
</template>

<script type="text/ecmascript-6">
import { getAccessToken, showLoginView, nativePush } from '../../common/hybrid'

export default {
  name: 'hybrid',
  data () {
    return {
      accessToken: 'accesstoken'
    }
  },
  created: function () {
    this.accessToken = getAccessToken()
    console.log(this.accessToken)
  },
  methods: {
    showNativeLoginView: () => {
      showLoginView()
    },
    nativepush: () => {
      const iOSParams = {
        class: 'LNDWebController',
        property: {
          contentURL: 'http://baidu.com',
          canRefresh: true
        }
      }
      const androidParams = {
        class: 'cn.lnts.fc.version3.square.AtUserListActivity',
        property: {
          userId: '1',
          canRefresh: true,
          videoId: 2150,
          double: 21.12010001
        }
      }
      nativePush(iOSParams, androidParams, res => {})
    }
  }
}
</script>
